from flask import Flask, request
from flask_cors import CORS

from taobao.taobao_search import taobao
from wechat.wechat_api import wechat

app = Flask(__name__)

@app.route('/api/taobao/search', methods=['POST'])
def taobao():
    data = request.get_json()
    text = data.get('text', '')

    return taobao.getOneData(text)

@app.route('/api/wechat', methods=['POST'])
def wechatapi():
    data = request.get_json()
    return wechat.api(data)

if __name__ == '__main__':
    CORS(app)
    app.run(debug=True, host='0.0.0.0', port=5050)